#include "Basket.h"

#include "Game.h"

Basket::Basket(Game *game, const char *pathImage, double scaleRate)
	:Object(game, pathImage,scaleRate) 
{
	setType(KindOfObject::kBasket);
	rect.sdlRect.x = rand() % (SCREEN_WIDTH - rect.sdlRect.w);
	rect.sdlRect.y = SCREEN_HEIGHT - rect.sdlRect.h ;
	life = LIVES;
}
void Basket::draw()
{
	Object::draw();
}
void Basket::update()
{
	Object::update();
}
void Basket::handleInput()
{
	if (game->KEYS[SDLK_LEFT] && rect.sdlRect.x - STEP_SPEED_BASKET_MOVING >=0)
		moveLeft();

	if (game->KEYS[SDLK_RIGHT]  && rect.sdlRect.x + rect.sdlRect.w + STEP_SPEED_BASKET_MOVING <= SCREEN_WIDTH)
		moveRight();
	if (game->occur.type == SDL_MOUSEMOTION)
	{
		if (game->occur.motion.x + rect.sdlRect.w <= SCREEN_WIDTH)
			setXPosition(game->occur.motion.x);
	}
}